MATLAB > Time Series Conversions |
Lead/lag specifies how much to offset the data through time. The offset can be in quote days, calendar days and calendar weeks. Each of those variants is supported by a method call on the connection object.
Currency and currency source specify which currency to convert the data from, and the source of the data for that currency.
Unit simply converts the data to a different unit of measurement, like litres to barrels.
Let's demonstrate each of these conversions on short and simple time series:
Let's get some plain data first:
>> getdailyrange(con,'/GCL','20-Jan-2010','30-Jan-2010')
Matlab replies with:
Time Series Collection Object: unnamed
Time vector characteristics
Start date 20-Jan-2010 00:00:00
End date 29-Jan-2010 00:00:00
Member Time Series Objects:
Open
High
Low
Close
Volume
OpenInterest
Now let's shift the data five calendar days into the future:
>> getdailyrange(con,'/GCL','20-Jan-2010','30-Jan-2010',con.CalendarDays(5))
The date range returned is now different:
Start date 25-Jan-2010 00:00:00
End date 03-Feb-2010 00:00:00
Or we can use quoted days instead:
>> getdailyrange(con,'/GCL','20-Jan-2010','30-Jan-2010',con.QuotedDays(5))
Again, the data is shifted into the future, but this time by five quoted days:
Start date 27-Jan-2010 00:00:00
End date 05-Feb-2010 00:00:00
But possibly instead of shifting the dates, we want to see the prices in Euros, as quoted by the Fed:
>> getdailyrange(con,'/GCL','20-Jan-2010','30-Jan-2010',[],'EUR','USF')
All the prices now get shifted to Euros.
Finally, we can convert from barrels to liters simply to using that as the last parameter and omiting the others:
>> getdailyrange(con,'/GCL','20-Jan-2010','30-Jan-2010',[],[],[], con.Liters)
Of course, all the conversions can be applied at the same time, they are just demonstrated here one at a time.
The valid unit conversions are: Barrels, Liters, Kiloliters, CubicMeters, Gallons, ThouStdCubicFt, MetricTons, ShortTons, MMBTUs, Therms, Gigajoules, GigawattHours, KilowattHours, MegawattHours. All of these are properties of the connection object.